For example, the HelloWorld example's Hello component could return the value of its visitorName instance variable along with the component name:
// WebScript Hello.mThe response component receives the descriptionForResponse:inContext: message after it receives the message appendToResponse:inContext:. The default implementation of descriptionForResponse:inContext: prints the page name. Unlike other methods invoked during the component action request-response loop, descriptionForResponse:inContext: is not sent to all components and dynamic elements on the page; it is sent only to the top-level response component.
- (NSString *)descriptionForResponse:(WOResponse *)response inContext:(WOContext *)context {
return [NSString stringWithFormat:@"%@/%@",
[self name], visitorName];
} //Java Hello.java
public String descriptionForResponse(WOResponse response, WOContext context) {
return new String(this.name() + visitorName);
}
Note that this method receives the response and context objects as arguments, just as appendToResponse:inContext: does. This means you can add such information as the HTTP header keys, or any other information recorded in these objects, to your description string. This description string is then appended to the log file in the CLFF format as discussed in "Maintaining a Log File".
Table of Contents
Next Section